package com.afei.java.ai.langchain4j.tools;

import dev.langchain4j.agent.tool.Tool;
import org.springframework.stereotype.Component;

/**
 * @Title: CalculatorTools
 * @Author wangyf
 * @Package com.afei.java.ai.langchain4j.tools
 * @Date 2025/4/24 17:15
 * @description:
 */

@Component
public class CalculatorTools {

    @Tool(name = "加法运算")
    double sum(double a, double b) {
        System.out.println("调用加法运算");
        return a + b;
    }

    @Tool
    double squareRoot(double x) {
        System.out.println("调用平方根运算");
        return Math.sqrt(x);
    }
}
